package main.model;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

import java.sql.Date;

public class Book {
    private final StringProperty title;
    private final StringProperty price;
    private final StringProperty author;
    private final StringProperty type;
    private final StringProperty amount;
    private final StringProperty message;
    private final StringProperty createTime;
    private final StringProperty returnTime;

    public Book(String title, String price, String author, String type, String amount, String message) {
        this.title = new SimpleStringProperty(title);
        this.price = new SimpleStringProperty(price);
        this.author = new SimpleStringProperty(author);
        this.type = new SimpleStringProperty(type);
        this.amount = new SimpleStringProperty(amount);
        this.message = new SimpleStringProperty(message);
        this.createTime = null;
        this.returnTime = null;
    }
    public Book(String title, String message, String amount) {
        this.title = new SimpleStringProperty(title);
        this.message = new SimpleStringProperty(message);
        this.amount =  new SimpleStringProperty(amount);
        this.price = null;
        this.author = null;
        this.type = null;
        this.createTime = null;
        this.returnTime = null;
    }
    public Book(String title, Date createTime){
        String createTimeString = createTime.toString();
        this.title = new SimpleStringProperty(title);
        this.createTime = new SimpleStringProperty(createTimeString);
        this.returnTime = null;
        this.message = null;
        this.amount =  null;
        this.price = null;
        this.author = null;
        this.type = null;
    }

    public void setTitle(String title){
        this.title.set(title);
    }
    public void setPrice(String price){
        this.price.set(price);
    }
    public void setAuthor(String author){
        this.author.set(author);
    }
    public void setType(String type){
        this.type.set(type);
    }
    public void setAmount(String amount){
        this.amount.set(amount);
    }
    public void setMessage(String message){
        this.message.set(message);
    }
    public void setCreateTime(String createTime){this.createTime.set(createTime);}
    public String getTitle(){
        return this.title.get();
    }
    public String getPrice(){
        return this.price.get();
    }
    public String getAuthor(){
        return this.author.get();
    }
    public String getType(){
        return this.type.get();
    }
    public String getAmount(){
        return this.amount.get();
    }
    public String getMessage(){
        return this.message.get();
    }
    public String getCreateTime(){return this.createTime.get();}
}
